<template>
	<view class="manage">
		<view class="opt">
			<button class="btn btn-1" @click="jumpTo">设置密码</button>
		</view>
		<view class="opt">
			<button class="btn btn-2">注销账号</button>
		</view>
		<view class="opt">
			<button class="btn btn-3" @click="logout">退出登录</button>
		</view>
	</view>
</template>

<script setup>
	
	// 退出登录
	const logout = ()=> {
		uni.showModal({
			title:"提示",
			content:"您确定退出登录状态?",
			success(res){
				// 询问一下用户是否退出登录，是就退出
				if(res.confirm) {
					
					// 把存储在本地用户身份删除掉
					uni.removeStorageSync("ZSSTB_ID")
					
					// 延迟300毫秒跳转登录页
					setTimeout(()=>{
						uni.redirectTo({
							url:"/pages/login/login"
						})
					},300)
				}
			}
		})
	}
	
	// 设置密码
	const jumpTo = ()=> {
		// 跳转设置密码页面
		uni.navigateTo({
			url:"/pages/setpwd/setpwd"
		})
	}
	
</script>

<style lang="scss">
@import "../../uni.scss";
.manage {
	padding: 20rpx 30rpx;
	.opt {
		margin-top: 20rpx;
		.btn {
			background-color: transparent;
		}
		.btn-1 {
			color: $active_color;
			&::after {
				border-color: $border_color;
			}
		}
		.btn-2 {
			color: white;
			background-color: red;
			&::after {
				border-color: red;
			}
		}
		.btn-3 {
			color: #f50;
			&::after {
				border-color: #f50;
			}
		}
	}
}
</style>
